import request from "@/utils/request";

function page(current, size, courseName, classroomName, className) {
    return request({
        method: 'GET',
        url: '/exam/page',
        params: {
            current: current,
            size: size,
            courseName: courseName,
            classroomName: classroomName,
            className: className,
        }
    });
}

function page_by_invigilator_id(invigilatorId, current, size, courseName, classroomName, className) {
    return request({
        method: 'GET',
        url: '/exam/page_by_invigilator_id',
        params: {
            invigilatorId: invigilatorId,
            current: current,
            size: size,
            courseName: courseName,
            classroomName: classroomName,
            className: className,
        }
    });
}

function page_by_student_id(studentId, current, size, courseName, classroomName, className) {
    return request({
        method: 'GET',
        url: '/exam/page_by_student_id',
        params: {
            studentId: studentId,
            current: current,
            size: size,
            courseName: courseName,
            classroomName: classroomName,
            className: className,
        }
    });
}

function add(startTime, endTime, courseId, classId,classroomId, invigilatorId, semesterId, studentCount) {
    return request({
        method: 'POST',
        url: '/exam',
        data: {
            startTime: startTime,
            endTime: endTime,
            courseId: courseId,
            classId:classId,
            classroomId: classroomId,
            invigilatorId: invigilatorId,
            semesterId: semesterId,
            studentCount: studentCount,
        }
    });
}

function edit(id, startTime, endTime, courseId,classId, classroomId, invigilatorId, semesterId, studentCount) {
    return request({
        method: 'PUT',
        url: '/exam',
        data: {
            id: id,
            startTime: startTime,
            endTime: endTime,
            courseId: courseId,
            classId:classId,
            classroomId: classroomId,
            invigilatorId: invigilatorId,
            semesterId: semesterId,
            studentCount: studentCount,
        }
    });
}

function del(id) {
    return request({
        method: 'DELETE',
        url: `/exam/${id}`,
    });
}

export default {
    page,
    page_by_invigilator_id,
    page_by_student_id,
    add,
    edit,
    del,
}